<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of privateForumUsers
 *
 * @author ivan
 */

include_once 'function.php';

class privateForumUsers {
    //put your code here
    
    private $userID;
    private $groupID;
    private $Db;
    
    public function __construct($groupID,$userID){
        
        $groupID = htmlspecialchars($groupID);
        $userID = htmlspecialchars($userID);
        
        $this->userID = $userID;
        $this->groupID = $groupID;
        $this->Db = Db();
    }
    
    
    public function add(){
        
        $query = $this->Db->prepare('INSERT INTO private(groupID,userID) values(:groupID,:userID)');
         $query->execute(array(
            'groupID' => $this->groupID,
             'userID' => $this->userID,
        ));
    }
    
    
    public function delete(){
        
       $queryDelete = $this->Db->prepare('DELETE from private where groupID = :groupID and userID = :userID');
                                            
            $queryDelete->execute(array('groupID'=>$this->groupID,'userID'=>$this->userID));
                       
    }
    
    
}
